#ifndef ANIMATIONEDITOR_H
#define ANIMATIONEDITOR_H

#include "abstracteditor.h"
#include <QTimer>
class Animation;

class AnimationEditor : public AbstractEditor
{
    Q_OBJECT
public:
    class AnimationView;
    explicit AnimationEditor(QObject *parent = 0);
    bool init();
    void activate();
    void deactivate();
private:
    void updateGUI();
    QPointer<Animation> m_currAnim;
signals:
    
public slots:
    void onParametersChanged();
};

class AnimationEditor::AnimationView : public QWidget
{
    Q_OBJECT
public:
    AnimationView(QWidget* parent = 0);
private:
    void paintEvent(QPaintEvent* pEvent);
    void dragEnterEvent(QDragEnterEvent* pEvent);
    void dropEvent(QDropEvent* pEvent);

    void mousePressEvent(QMouseEvent* pEvent);
    void mouseMoveEvent(QMouseEvent* pEvent);
    void mouseReleaseEvent(QMouseEvent* pEvent);

    void enterEvent(QEvent* pEvent);
    void leaveEvent(QEvent* pEvent);

    QRect zoomInRect() const;
    QRect zoomOutRect() const;

    QPointer<Animation> m_anim;
    QPixmap m_pixZoomIn;
    QPixmap m_pixZoomOut;

    QPoint m_zoomInPos;
    QPoint m_zoomOutPos;

    bool m_bZoomInMouseOver;
    bool m_bZoomOutMouseOver;

    bool m_bShowZoomOptions;

    float m_fZoomFactor;
public slots:
    void setAnimation(QPointer<Animation> anim);
};

#endif // ANIMATIONEDITOR_H
